﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Himall.Entity.Config
{
   public class ProductInfoConfig : EntityTypeConfiguration<ProductInfo>
    {
        public ProductInfoConfig()
        {
            ToTable("Himall_Products");
            Property(item => item.CategoryPath).HasColumnType("varchar").HasMaxLength(200);
            Property(item => item.ProductName).HasColumnType("varchar").HasMaxLength(100);
            Property(item => item.ProductCode).HasColumnType("varchar").HasMaxLength(200);
            Property(item => item.ShortDescription).HasColumnType("varchar").HasMaxLength(1000);
            Property(item => item.ImagePath).HasColumnType("varchar").HasMaxLength(200);
            Property(item => item.MeasureUnit).HasColumnType("varchar").HasMaxLength(100);
            HasRequired(x => x.Himall_Categories).WithMany(x => x.Himall_Products).HasForeignKey(x => x.CategoryId);
            HasRequired(x => x.Himall_Shops).WithMany(x => x.Himall_Products).HasForeignKey(x => x.ShopId);
            HasRequired(x => x.Himall_FreightTemplate).WithMany(x => x.Himall_Products).HasForeignKey(x => x.FreightTemplateId);
        }
    }
}
